﻿using SqlSugar;

namespace NetMicro.Domains.Repositories
{
    /// <summary>
    /// 仓储基类
    /// </summary>
    public abstract class RepositoryBase : IRepositoryBase
    {
        private readonly DbContext _context;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        protected RepositoryBase(DbContext context)
        {
            _context = context;
        }
        /// <summary>
        /// db
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public SqlSugarClient SugarClient(SqlSugarClient client = null) => client == null ? _context.Db() : client;
    }
}
